

package com.base.test.mutual.redis;

import com.base.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 验证码Redis
 * @author  carl
 * @since 1.0.0
 */
@Component
public class TokenRedis<T> {
    /**  过期时长为3小时，单位：秒 */
    public final static long HOUR_ONE_EXPIRE = 60 * 60 * 3L;
    @Autowired
    private RedisUtils redisUtils;

    public void set(T token, String key){
        redisUtils.set(key, token, HOUR_ONE_EXPIRE);
    }

    public <T> T get(String key){
        return (T) redisUtils.get(key);
    }

}